move XS_DEBUG code into a proper function
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Wed, 15 Mar 2006 12:08:10 +0000 (12:08 +0000)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Wed, 15 Mar 2006 12:08:10 +0000 (12:08 +0000)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
tools/xenstore/xenstored_core.c

index bfa71f56bd174104a8694bebd9e9ee5e58c906c3..70760468014c0df76812dac25d297c8abfada5fb 100644 (file)
@@ -1113,6 +1113,25 @@ static void do_set_perms(struct connection *conn, struct buffered_data *in)
        send_ack(conn, XS_SET_PERMS);
 }
 
+static void do_debug(struct connection *conn, struct buffered_data *in)
+{
+       if (streq(in->buffer, "print"))
+               xprintf("debug: %s", in->buffer + get_string(in, 0));
+       if (streq(in->buffer, "check"))
+               check_store();
+#ifdef TESTING
+       /* For testing, we allow them to set id. */
+       if (streq(in->buffer, "setid")) {
+               conn->id = atoi(in->buffer + get_string(in, 0));
+       } else if (streq(in->buffer, "failtest")) {
+               if (get_string(in, 0) < in->used)
+                       srandom(atoi(in->buffer + get_string(in, 0)));
+               failtest = true;
+       }
+#endif /* TESTING */
+       send_ack(conn, XS_DEBUG);
+}
+
 /* Process "in" for conn: "in" will vanish after this conversation, so
  * we can talloc off it for temporary variables.  May free "conn".
  */
@@ -1159,21 +1178,7 @@ static void process_message(struct connection *conn, struct buffered_data *in)
                break;
 
        case XS_DEBUG:
-               if (streq(in->buffer, "print"))
-                       xprintf("debug: %s", in->buffer + get_string(in, 0));
-               if (streq(in->buffer, "check"))
-                       check_store();
-#ifdef TESTING
-               /* For testing, we allow them to set id. */
-               if (streq(in->buffer, "setid")) {
-                       conn->id = atoi(in->buffer + get_string(in, 0));
-               } else if (streq(in->buffer, "failtest")) {
-                       if (get_string(in, 0) < in->used)
-                               srandom(atoi(in->buffer + get_string(in, 0)));
-                       failtest = true;
-               }
-#endif /* TESTING */
-               send_ack(conn, XS_DEBUG);
+               do_debug(conn, in);
                break;
 
        case XS_WATCH: